9.2 Binding and Evaluation
Evaluation reduces a real expression to a single real,
a composite expression to a simple composite with reduced components and
a collection value to a simple collection with reduced items.
When the evaluated expression contains variables,
To begin with a simple example, consider the active expression
Like substitution, Evaluate also examines the workspace for variable definitions. But instead of symbolic substitution, variables are bound directly to definitions, as shown in Figure 9.5. (For this purpose, suitable equations are promoted to definitions.) And, as opposed to the symbolic manipulation performed by simplification, evaluation performs numeric calculation directly on the bound values.

Bindings are ephemeral. They last only as long as necessary to complete evaluation. This is because expressions on the display are all independent; they can be added, deleted and manipulated symbolically in any order without concern for whether a variable has a valid definition. New bindings are established every time an expression is evaluated.
The process of binding begins with a set of unbound expressions and a set of definitions. The set of unbound expressions initially contains just the subject of evaluation. The set of definitions is created by examining each inactive expression for potential definitions. Binding then proceeds by examining each expression in the set of unbound expressions for variable names. If an association between a name and a definition can be made, the elaboration of that definition is added to the set of unbound expressions. Binding ends when all elements of the set of unbound expressions have been examined.
Since elaborations of definitions that are not referenced are never
added to the unbound set and therefore never examined, a consequence
of the binding process is that incompletely defined expressions that
are never referenced are never bound. To illustrate, consider
evaluation of

The description of binding uses the terms name, scope and namespace. A scope is a set of definitions; a namespace is a tuple of scopes. A definition is a name and its elaboration (essentially, just some expression). A name is a typed variable or a typed function name along with its formal parameter types. Both variable and function names can be sub- or super-scripted. A reference is a typed variable name or typed function along with parameter types taken from its arguments. A reference is resolved by searching the namespace and the scopes therein for the first occurrence of the name referenced. During resolution, references are bound to definitions.
The namespace created in the initial examination consists of a single scope called the global scope. When a definition's elaboration is considered at a later stage, it may contribute transient definitions to a new scope that augments the namespace.
An example of this is a function that generates a tuple:

In a slight variation on the same example,
A more Byzantine example is given by

Binding also takes place within a serial tuple. A new scope is started when binding the tuple and variables defined within the scope remain local to the tuple. An example is shown in Figure 9.9.
